package com.zbs.framework.common.weixin;

import com.google.common.collect.Lists;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@ConfigurationProperties(prefix = "wx.open")
public class ConstantWxUtils {
    //公众号基础配置
    public static String appId;
    public static String appSecret;
    public static String appAseKey;
    public static String appToken;

    public void setAppId(String appId) {
        ConstantWxUtils.appId = appId;
    }
    public void setAppSecret(String appSecret) {
        ConstantWxUtils.appSecret = appSecret;
    }
    public void setAppAseKey(String appAseKey) {
        ConstantWxUtils.appAseKey = appAseKey;
    }
    public void setAppToken(String appToken) {
        ConstantWxUtils.appToken = appToken;
    }

    public static List<WxTemplateData> build(String first, String keyword1, String keyword2, String keyword3, String remark){
        return new ConstantWxUtils().setTemplateData( first, keyword1, keyword2, keyword3, remark);
    }

    public static List<WxTemplateData> build(String first, String keyword1, String keyword2, String keyword3,String keyword4,String keyword5, String remark){
        return new ConstantWxUtils().setTemplateData( first, keyword1, keyword2, keyword3,keyword4,keyword5, remark);
    }

    private List<WxTemplateData> setTemplateData(String first,String keyword1,String keyword2,String keyword3,String remark){
        List<WxTemplateData> dataList = Lists.newLinkedList();
        dataList.add(WxTemplateData.build("first",first,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword1",keyword1,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword2",keyword2,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword3",keyword3,"#3C98FA"));
        dataList.add(WxTemplateData.build("remark",remark,"#3C98FA"));
        return dataList;
    }

    private List<WxTemplateData> setTemplateData(String first,String keyword1,String keyword2,String keyword3,String keyword4,String keyword5,String remark){
        List<WxTemplateData> dataList = Lists.newLinkedList();
        dataList.add(WxTemplateData.build("first",first,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword1",keyword1,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword2",keyword2,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword3",keyword3,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword4",keyword4,"#3C98FA"));
        dataList.add(WxTemplateData.build("keyword5",keyword5,"#3C98FA"));
        dataList.add(WxTemplateData.build("remark",remark,"#3C98FA"));
        return dataList;
    }
}
